<?php use_helper('I18N') ?>
<?php use_stylesheets_for_form( $form ) ?>
<?php
  // Override the login slot so that we don't get a login prompt on the
  // apply page, which is just odd-looking. 0.6
?>
<?php slot('sf_apply_login') ?>
<?php end_slot() ?>
<?php include_partial('register/steps', array('step' => 1)) ?>

<h1 class="title">Inscription</h1>

<?php foreach($form as $field => $f): ?>
    <?php $attributes[$field] = array() ?>
<?php endforeach ?>

<?php if ($form->hasErrors()): ?>
    <?php foreach($form as $field => $f): ?>
        <?php if($f->hasError()): ?>
            <?php $attributes[$field] = array('class' => 'error') ?>
        <?php endif ?>
    <?php endforeach ?>
    <div class="box_relief red">Certains champs sont incomplets et/ou invalides.</div>
<?php endif; ?>


<h2>Vos informations personnelles</h2>
<form method="POST" action="<?php echo url_for('sfApply/apply') ?>" name="sf_apply_apply_form" id="sf_apply_apply_form">
    <table>
        <tr>
            <td></td>
            <td><?php echo $form['username']->renderError() ?></td>
        </tr>
        <tr>
             <td><?php echo $form['username']->renderLabel('Login* :', $attributes['username']) ?></td>
             <td><?php echo $form['username']->render() ?></td>
        </tr>
        <tr>
            <td></td>
            <td><?php echo $form['password']->renderError() ?></td>
        </tr>
        <tr>
             <td><?php echo $form['password']->renderLabel('Mot de passe* :', $attributes['password']) ?></td>
             <td><?php echo $form['password']->render() ?></td>
        </tr>
        <tr>
            <td></td>
            <td><?php echo $form['password2']->renderError() ?></td>
        </tr>
        <tr>
             <td><?php echo $form['password2']->renderLabel('Confirmer le mot de passe* :', $attributes['password2']) ?></td>
             <td><?php echo $form['password2']->render() ?></td>
        </tr>
        <tr>
            <td></td>
            <td><?php echo $form['lastname']->renderError() ?></td>
        </tr>
        <tr>
             <td><?php echo $form['lastname']->renderLabel('Nom* :', $attributes['lastname']) ?></td>
             <td><?php echo $form['lastname']->render() ?></td>
        </tr>
        <tr>
            <td></td>
            <td><?php echo $form['firstname']->renderError() ?></td>
        </tr>
        <tr>
             <td><?php echo $form['firstname']->renderLabel('Prénom* :', $attributes['firstname']) ?></td>
             <td><?php echo $form['firstname']->render() ?></td>
        </tr>
        <tr>
            <td></td>
            <td><?php echo $form['email']->renderError() ?></td>
        </tr>
        <tr>
             <td><?php echo $form['email']->renderLabel('Adresse email* :', $attributes['email']) ?></td>
             <td><?php echo $form['email']->render() ?></td>
        </tr>
        <tr>
            <td></td>
            <td><?php echo $form['email2']->renderError() ?></td>
        </tr>
        <tr>
             <td><?php echo $form['email2']->renderLabel('Confirmer l\'email* :', $attributes['email2']) ?></td>
             <td><?php echo $form['email2']->render() ?></td>
        </tr>
    </table>
    <h2>Vos informations tennis de table</h2>
    <table>
        <tr>
            <td></td>
            <td><?php echo $form['licensee']['licensee_number']->renderError() ?></td>
        </tr>
        <tr>
             <td><?php echo $form['licensee']['licensee_number']->renderLabel('N° licence :') ?></td>
             <td><?php echo $form['licensee']['licensee_number']->render() ?></td>
        </tr>
        <tr>
            <td></td>
            <td><?php echo $form['licensee']['category']->renderError() ?></td>
        </tr>
        <tr>
             <td><?php echo $form['licensee']['category']->renderLabel('Catégorie :') ?></td>
             <td><?php echo $form['licensee']['category']->render() ?></td>
        </tr>
    </table>
    <h2>Votre club</h2>
    <table id="club_list">
        <tr>
            <td></td>
            <td><?php echo $form['licensee']['club_id']->renderError() ?></td>
        </tr>
        <tr>
             <td><?php echo $form['licensee']['club_id']->renderLabel('N° ou nom du club :') ?></td>
             <td><?php echo $form['licensee']['club_id']->render() ?></td>
        </tr>
        <tr>
             <td></td>
             <td><em><a href="#panel-register" id="link_register_club">Votre club n'est pas présent ?</a></em></td>
        </tr>
    </table>
    <table id="register_club" style="display: none;">
        <tr>
             <td colspan="2"><em><a href="#panel-register" id="link_club_list">Annuler l'enregistrement de votre club</a></em></td>
        </tr>
        <tr>
            <td></td>
            <td><?php echo $form['club']['name']->renderError() ?></td>
        </tr>
        <tr>
             <td><?php echo $form['club']['name']->renderLabel('Nom du club* :') ?></td>
             <td><?php echo $form['club']['name']->render() ?></td>
        </tr>
        <tr>
            <td></td>
            <td><?php echo $form['club']['club_number']->renderError() ?></td>
        </tr>
        <tr>
             <td><?php echo $form['club']['club_number']->renderLabel('N° du club* :') ?></td>
             <td><?php echo $form['club']['club_number']->render() ?></td>
        </tr>
        <tr>
            <td></td>
            <td><?php echo $form['club']['city_id']->renderError() ?></td>
        </tr>
        <tr>
             <td><?php echo $form['club']['city_id']->renderLabel('Ville :') ?></td>
             <td><?php echo $form['club']['city_id']->render() ?></td>
        </tr>
        <tr>
            <td></td>
            <td><?php echo $form['club']['website']->renderError() ?></td>
        </tr>
        <tr>
             <td><?php echo $form['club']['website']->renderLabel('Site web :') ?></td>
             <td><?php echo $form['club']['website']->render() ?></td>
        </tr>
    </table>
    <h2>Validation de votre inscription</h2>
    <table>
        <tr>
            <td></td>
            <td><?php echo $form['cgu']->renderError() ?></td>
        </tr>
        <tr>
            <td colspan="2">
                <?php echo $form['cgu']->render() ?>
                <span class="read_cgu">
                    J'ai lu et j'accepte les <?php echo link_to('Conditions Générales d\'Utilisation (CGU)', '@cgu', array('target' => '_blank')) ?>*
                </span>
            </td>
        </tr>
        <tr>
            <td></td>
            <td><?php echo $form['captcha']->renderError() ?></td>
        </tr>
        <tr>
            <td><?php echo $form['captcha']->renderLabel('Captcha* :', $attributes['captcha']) ?></td>
            <td>
                <?php echo $form['captcha']->render() ?>
                <?php echo $form->renderHiddenFields(); ?>
            </td>
        </tr>
    </table>
    <input type="submit" class="box_relief dark_blue" value="<?php echo __("Create My Account", array(), 'sfForkedApply') ?>" />
</form>
<p class="mandatoryInformations">(*) Informations obligatoires</p>

<?php slot('leftPanel') ?>
    <li class="parent"><?php include_partial('register/whyRegister', array('page' => 'register')) ?></li>
<?php end_slot() ?>